﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Barbar.MapReport.Common {
  public static class BusinessValueHelper {
    private static BusinessValueComparer _Instance = new BusinessValueComparer();

    public static IComparer<IBusinessValue> Comparer {
      get { return _Instance; }
    }

    public static IEnumerable<IBusinessValue> ConvertEnumeration<T>(IEnumerable<T> items) where T : IBusinessValue {
      foreach (T item in items)
        yield return item;
    }

    private class BusinessValueComparer : IComparer<IBusinessValue> {
      #region IComparer<IBusinessValue> Members

      public int Compare(IBusinessValue x, IBusinessValue y) {
        return x.Value.CompareTo(y.Value);
      }

      #endregion
    }
  }
}
